package com.demo.react.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.demo.react.entity.Comment;
import com.demo.react.repository.CommentRepostory;
import com.demo.react.service.CommentService;

@Service
public class CommentServiceImpl implements CommentService {

	@Autowired
	private CommentRepostory commentRepostory;

	// rollbackForClassName = "java.lang.Exception"
	// value = "txManager1", propagation = Propagation.REQUIRED
	@Transactional
	@Override
	public Comment inserComment(Comment comment) {
		return commentRepostory.save(comment);
	}

	@Override
	public Page<Comment> commentList(Pageable pageable) {
		return commentRepostory.queryCommentList(pageable);
	}

}
